#{extends 'main.html' /}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="" lang="">
    <head>
        <title></title>		
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <link rel="stylesheet" type="text/css" media="screen" href="/public/stylesheets/crud.css" />
    </head>
	<body id="crud">						
		<div id="crudContent">
			<div id="crudShow" class="RoleCRUD">
	
	<h2 id="crudShowTitle">Edit Role</h2>
	
	<div class="objectForm">
	<div class="crudField">
	<label for="roles_in_system"> 
		Choose Role to inherit from:
		</label> 
		#{form @RoleCRUD.showWithInheritance(myRole.getEntityId(),inheritRole)}
		<select id="roles_in_system" name="inheritRole">
		#{list items:rList, as:'role'}
		<option value="${role.id}" ${inheritRole==role.id?' selected':''}>${role.title}</option>	
		#{/list}
		</select>
		<input type="submit" name="Inherit" value="Inherit" />
		#{/form}
	</div> 
					
<form action="/rolecrud/save?id=${myRole.id}" method="POST" accept-charset="utf-8" enctype="multipart/form-data">		
	<div class="crudField">
	<input id="object_isSystem" class="" type="hidden" name="object.isSystem" value="true"/>
	</div> 
	
	<div class="crudField"> 
	<label for="object_title">
		Title:
	</label>
	<input id="object_title" class="validate[required]" type="text" name="object.title" value="${myRole.title}" size="20" /> <font color="red">*</font>
    <span class="crudHelp">
    	Required.
	</span>
	</div>
		
	<div class="crudField">
	<label for="object_actions">
		Allowed Actions:
	</label>
	<div class="actions-list">
		<select id="object_actions" class="validate[required]" name="object.actions@id" multiple="yes">
		#{list items:aList, as:'action'}
		#{list items:aSelList, as:'actionSel'}
		#{if action.id==actionSel.id}
		<option value="${action.id}" selected="true">${action}</option>
		%{flag = "true";}%
		#{/if}
		#{/list}
		#{if flag != "true"}
		<option value="${action.id}">${action}</option>
		#{/if}
		%{flag = "false";}%
		#{/list}
		</select>
	</div>
	<font color="red">*</font>
	<span class="crudHelp">
		At Least one Action is Required.
	</span> 
	</div>
	</div>
	
	<br>
	<br>
	<br>
	<p class="crudButtons">
		<input type="submit" name="_save" value="Save" />
		<input type="submit" name="_saveAndContinue" value="Save and continue editing" />
	</p>
	

</form>	
				
</div> 
			</div>
		</div>
	</body> 
</html> 
